class Solution {
public:
    vector<vector<string>> groupAnagrams(vector<string>& strs) {
       unordered_map<string,vector<string>> ans;
       for(const auto& s:strs)
       {
        string tmp=s;
        sort(tmp.begin(),tmp.end());
        ans[tmp].push_back(s);
       }
        
        vector<vector<string>> ret;
        for(const auto& [_,value]:ans)
        {
            ret.push_back(value);
        }
        return ret;
    }
};